$(document).ready(function(){
	$("#generate").click(function(){
		var name = $("#name").val();
		var type = $(".type:checked").attr("id");
		var chl = "";
		if(type=="url")
			chl = name;
		if(type=="text")
			chl = name;
		if(type=="sms")
			chl = "smsto:"+name;
		if(type=="phone-number")
			chl = "tel:"+name;
		var source = "http://chart.apis.google.com/chart?cht=qr&chs=190x190&chld=L&choe=UTF-8&chl="+chl; 
		$(".return").val(source);
		$("#img-generate").attr("src",source);
	});
	$(".return").focus(function(){
		$(this).select();
	});
});